package sanshui.system.trade.factory.trade.strategy;

import sanshui.system.trade.factory.trade.indicator.IndicatorCode;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public enum StrategyCode {
    DEFAULT("DEFAULT", "默认策略", new ArrayList<>()),
    GRID("GRID", "网格交易", new ArrayList<>()),
    M45("M45", "M45", Arrays.asList(IndicatorCode.M5, IndicatorCode.M10)),
    ZZ2000("ZZ2000", "小市值2000策略", new ArrayList<>()),
    TURTLE("TURTLE", "海龟策略", Arrays.asList(IndicatorCode.ATR10));

    private String code;
    private String message;
    private List<IndicatorCode> indicatorCodes;

    StrategyCode(String code, String message, List<IndicatorCode> indicatorCodes) {
        this.code = code;
        this.message = message;
        this.indicatorCodes = indicatorCodes;
    }

    public StrategyCode codeOf(String code) {
        for (StrategyCode value : StrategyCode.values()) {
            if (value.getCode().equalsIgnoreCase(code)) {
                return value;
            }
        }
        return StrategyCode.DEFAULT;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public List<IndicatorCode> getIndicatorCodes() {
        return indicatorCodes;
    }
}
